@extends("layouts.app")
@section('content')
<script src="{{env('URL_SUB', '')}}/static/datetimepicker/bootstrap-datetimepicker.js"></script>
<script src="{{env('URL_SUB', '')}}/static/datetimepicker/bootstrap-datetimepicker.fr.js"></script>
<link href="{{env('URL_SUB', '')}}/static/datetimepicker/bootstrap-datetimepicker.min.css" rel="stylesheet">
    <section class="content-header">
        <h1>
            分享日志管理
        </h1>
        <ol class="breadcrumb">
            <li><a href="/dashboard"><i class="fa fa-dashboard"></i>家</a></li>
            <li><a href="#">分享日志管理</a></li>
            <li class="active">分享日志列表</li>
        </ol>
    </section>
    <section class="content">
                <div class="row">
            <div class="col-xs-12">
                <div class="box">
                    <div class="box-header with-border">
                        <h3 class="box-title">搜索</h3>
                        <div class="box-tools"></div>
                    </div>
                    <div class="box-body">
                        <div id="example2_wrapper" class="dataTables_wrapper form-inline dt-bootstrap">
                    <form class="form-inline" role="form" method="get" id="frmSearch">
                        <div class="form-group">
                            <select class="form-control type form-inline" name="channel">
                                <option value="">分享类型</option>
                                <option value="friend">好友</option>
                                <option value="friends">朋友圈</option>
                            </select>
                        </div>&nbsp;
                        <div class="form-group">
                            <label class="sr-only" for="exampleInputEmail3"></label>
                            <input type="text" class="form-control pull-right datepicker" name="starttime" data-date-format="yyyy-mm-dd" placeholder="请输入开始日期">
                        </div>
                        &nbsp;
                        <div class="form-group">
                            <label class="sr-only" for="exampleInputEmail3"></label>
                            <input type="text" class="form-control pull-right datepicker" name="endtime" placeholder="请输入截止日期">
                        </div>
                        &nbsp;
                        <input type="submit" class="btn  btn-success" value="搜索">&nbsp;
                    </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        
    <script>
        $('.datepicker').datetimepicker({
            autoclose: true,
            format: 'yyyy-mm-dd',
            minView : 2
        });
        $(function(){
            var search = location.search.substring(1);
            if (search) {
                try {
                    var query = JSON.parse('{"' + decodeURIComponent(search).replace(/"/g, '\\"').replace(/&/g, '","').replace(/=/g, '":"') + '"}');

                    $.each(query, function(k, v) {
                        $('[name=' + k + ']').val(v);
                    });
                } catch (e) {
                    console.log(e);
                }

            }
        })
    </script>
        <div class="row">
            <div class="col-sm-12">
                <div class="box">
                    <div class="box-header with-border box-danger">
                        <h3 class="box-title">列表</h3>
                    </div>

                <!-- /.box-body -->
                    <div class="box-body">
                        <div id="example2_wrapper" class="dataTables_wrapper form-inline dt-bootstrap">
                            <div class="row">
                                <div class="col-sm-6"></div>
                                <div class="col-sm-6"></div>
                            </div>
                            <div class="row">
                                <div class="col-sm-12">
                                    <table id="example2" class="table table-bordered table-hover dataTable text-center" role="grid"
                                           aria-describedby="example2_info">
                                        <thead>
                                        <tr role="row">
  
                                            <th class="sorting col-sm-1" aria-controls="example2" rowspan="1"
                                                colspan="1"
                                                aria-label="Browser: activate to sort column ascending">
                                                userID
                                            </th>
                                            <th class="sorting col-sm-1" aria-controls="example2" rowspan="1"
                                                colspan="1"
                                                aria-label="Browser: activate to sort column ascending">
                                                昵称
                                            </th>
                                            <th class="sorting col-sm-2" aria-controls="example2" rowspan="1"
                                                colspan="1"
                                                aria-label="Platform(s): activate to sort column ascending">
                                                头像
                                            </th>
                                            <th class="sorting col-sm-2" aria-controls="example2" rowspan="1"
                                                colspan="1"
                                                aria-label="Engine version: activate to sort column ascending">
                                                openid
                                            </th>
                                            <th class="sorting col-sm-1" aria-controls="example2" rowspan="1"
                                                colspan="1"
                                                aria-label="Browser: activate to sort column ascending">
                                                分享类型
                                            </th>
                                            <th class="sorting col-sm-2" aria-controls="example2" rowspan="1"
                                                colspan="1"
                                                aria-label="Engine version: activate to sort column ascending">
                                                分享时间
                                            </th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        @foreach($list as $value)
                                            <tr role="row" class="odd">
                                                <td>{{$value->userid}}</td>
                                                <td>{{$value->nickname}}</td>
                                                <td><img src="{{$value->avatar}}" alt="" width="50px"></td>
                                                <td>{{$value->openid}}</td>
                                                <td>@if($value->channel == 'friend')好友@else朋友圈@endif</td>
                                                <td>{{$value->created_at}}</td>
                                            </tr>
                                        @endforeach
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                            @include("layouts.page",['paginator'=>$list])
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
    <script src="{{env('URL_SUB', '')}}/bower_components/AdminLTE/plugins/iCheck/icheck.min.js"></script>
    <script src="{{env('URL_SUB', '')}}/bower_components/AdminLTE/plugins/iCheck/icheck.js"></script>
@endsection
